var express = require('express');
var router = express.Router();
var shell=require('shelljs');
router.get('/update', function(req, res, next) {
	let port=req.query.port
	shell.exec("/root/expect.sh "+port,function(code, stdout, stderr){
	console.log('Exit code:', code);
		  console.log('Program output:', stdout);
		  console.log('Program stderr:', stderr);
	})
	res.send('success');
});
/* GET users listing. */
router.get('/', function(req, res, next) {
  shell.exec("pm2 restart all")
	res.send('respond with a resource');
});

module.exports = router;
